#!/bin/sh
# Generic postinst for IIIMF language engines
# Copyright © 2007 Roger So <rogerso@debian.org>

set -e

ua_inst () {
	update-alternatives \
		--install /etc/X11/xinit/xinput.d/$1 xinput-$1 \
		/etc/X11/xinit/xinput.d/$2 $3 ;
}

case "$1" in
        configure)
                /usr/bin/iiimf-le-tools -g --install /usr/lib/iiim/le/unihan2/unihan2.so

		pkgdatadir=/usr/share/unihan2
		if [ ! -e $pkgdatadir/phrase.db ]
		then
			cp $pkgdatadir/phrase.db.dist $pkgdatadir/phrase.db
		fi

		ua_inst all_ALL unihan  0
		ua_inst zh_CN   unihan 50
		ua_inst zh_TW   unihan 50
		ua_inst zh_HK   unihan 50
		ua_inst zh_MO   unihan 50
		ua_inst zh_SG   unihan 50
                ;;
        abort-upgrade|abort-remove|abort-deconfigure)
                ;;
        *)
                echo "postinst called with unknown argument \`$1'" >&2
                exit 1
                ;;
esac

#DEBHELPER#

# vim:fileencoding=utf-8
